home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4393 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.3 KB  |  32 lines

  1. Newsgroups: comp.lang.c++
  2. Path: mackeyes.chinalake.navy.mil!keyes
  3. From: Chip Keyes <keyes@vislab.navy.mil>
  4. Subject: Re: constant definitions in header files
  5. Message-ID: <DLyyp0.8nF@avalon.chinalake.navy.mil>
  6. X-Xxmessage-Id: <AD32ACCBD3015575@mackeyes.chinalake.navy.mil>
  7. X-Xxdate: Mon, 29 Jan 96 00:56:43 GMT
  8. Sender: usenet@avalon.chinalake.navy.mil (NAWS news admin)
  9. Organization: Naval Air Warfare Center
  10. X-Useragent: Version 1.1.3
  11. References: <3107699E.3EA5@mw_tx1.tca.fgg.eur.nl>
  12. Date: Tue, 30 Jan 1996 00:58:12 GMT
  13.  
  14. In article <3107699E.3EA5@mw_tx1.tca.fgg.eur.nl> Stefan Nelwan,
  15. nelwan@mw_tx1.tca.fgg.eur.nl writes:
  16. >In article <3107699E.3EA5@mw_tx1.tca.fgg.eur.nl> Stefan Nelwan,
  17. nelwan@mw_tx1.tca.fgg.eur.nl writes:
  18. >I am curious about the common implementation of using const int's in
  19. >header files under 
  20. >different compilers. According to "The C++ programming language"
  21. >(Stroustrup), only 
  22. >simple constants may be placed in header files. It is up to the compiler
  23. >to ensure no
  24. >redundant copies of those constants are generated. 
  25. >
  26.  
  27. Global consts have internal linkage, they are only visible within the
  28. file it isi defined in.  Therefore  each file will have its own copy of
  29. the constants defined in the included header file. Consts are a
  30. peculiarity because they are the only variable type that has internal
  31. linkage and yet can be made visible externally.
  32.